package leetcode_2501_2600;

import java.util.Arrays;

public class LeeCode_2592 {
    public static void main(String[] args) {

    }
    private static int maximizeGreatness(int[] nums) {
        Arrays.sort(nums);
        int l = 0, r = 1, n = nums.length, ans = 0;
        while (r < n){
            while (r < n && nums[r] <= nums[l]){
                r++;
            }
            if (r < n){
                ans++;
            }
            l++;
            r++;
        }
        return ans;
    }
}
